package com.Pounds.control;

import com.Pounds.pojo.Post;
import com.Pounds.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("trane/post")
public class PostControl {

    @Autowired
    private PostService postService;

    @GetMapping("all")
    public List<Post>[] getPostList(String timestamp, String number){
        return postService.getPostList(timestamp, number);
    }

    @GetMapping("user")
    public List<Post>[] getPersonalPostList(){
        return postService.getPersonPostList();
    }

    @PostMapping("new")
    public void addNewPost(){
        postService.addNewPost();
    }

    @PostMapping("comment")
    public void addNewComment(){
        postService.addNewComment();
    }

    @PostMapping("like")
    public void addNewLike(){
        postService.addNewLike();
    }
}
